package com.data.basic.chapter08;

import com.data.basic.chapter03.*;

/**   优先队列的实现：利用最大堆来实现优先队列
 * Created by wangbing on 2018/5/31.
 */
public class ProporityQueue<E extends Comparable<E>> implements Queue<E> {

    private MaxHeap<E> maxHeap;

    public ProporityQueue() {
    maxHeap = new MaxHeap<E>();
    }

    public void enqueue(E e) {
        maxHeap.add(e);

    }

    public E dequeue() {
        return maxHeap.extractMax();
    }

    public E getFront() {
        return maxHeap.findMax();
    }


    public int getSize() {
        return maxHeap.size();
    }

    public boolean isEmpty() {
        return maxHeap.isEmpty();
    }
}
